<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- reduce 数组的方法，用于累加数据 -->
    <script>
        const arr=[{a:1,b:2},{a:2,b:3}]
        let narr=arr.reduce((prev,item)=>{
            return prev+item.a+item.b
        },0)
        console.log(narr)
    </script>
</body>
</html>